package androidgame.framework.impl;

import android.media.SoundPool;

import androidgame.framework.Sound;

// Handles all sounds for the game (anything non-music). Provides a play and dispose method.
// Dispose should be used to free memory when a sound will no longer be played.
// @author dicarlo2

public class AndroidSound implements Sound {
    int soundId;
    SoundPool soundPool;
    
    public AndroidSound(SoundPool soundPool,int soundId) {
        this.soundId = soundId;
        this.soundPool = soundPool;
    }

    @Override
    public void play(float volume) {
        soundPool.play(soundId, volume, volume, 0, 0, 1);
    }

    @Override
    public void dispose() {
        soundPool.unload(soundId);
    }

}
